﻿<UserControl x:Class="myCollections.UserControls.UcBooksDetail"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:converters="clr-namespace:myCollections.Utils"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <UserControl.Resources>
        <converters:DetailsPaneHeightConverter x:Key="detailsPaneHeightConverter" />
    </UserControl.Resources>

    <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" 
                   Height="{Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=1,
                                                    AncestorType={x:Type Canvas}}, 
                                                    Path=ActualHeight,Converter={StaticResource detailsPaneHeightConverter}}" 
                   Width="237">
        <Grid Background="Transparent" MaxWidth="235">
            <Grid.ColumnDefinitions>
                <ColumnDefinition MaxWidth="220"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <TextBlock Grid.Row="0" FontSize="16" FontWeight="Bold" TextWrapping="Wrap" TextAlignment="Center" 
                        VerticalAlignment="Center" TextTrimming="CharacterEllipsis" HorizontalAlignment="Center"
                        Text="{Binding Path=Title,Mode=OneTime}" ToolTip="{Binding Path=Title,Mode=OneTime}"/>

            <StackPanel Grid.Row="1" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblAuthor}" FontWeight="Heavy" Name="titleAuthor" />
                <TextBlock Name="lblAuthor"/>
            </StackPanel>

            <StackPanel Grid.Row="2" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblMedia}" FontWeight="Heavy" ToolTip="{Binding Path=Media.Name,Mode=OneTime}"/>
                <TextBlock Text="{Binding Path=Media.Name,Mode=OneTime}" ToolTip="{Binding Path=Media.Name,Mode=OneTime}" />
            </StackPanel>

            <StackPanel Grid.Row="3" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblFilePath}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" FontWeight="Heavy" ToolTip="{Binding Path=FilePath,Mode=OneTime}"/>
                <TextBlock TextWrapping="Wrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=FilePath,Mode=OneTime}" ToolTip="{Binding Path=FilePath,Mode=OneTime}" />
            </StackPanel>

            <StackPanel Grid.Row="4" Orientation="Horizontal" >
                <TextBlock Text="{DynamicResource lblFileName}" FontWeight="Heavy" ToolTip="{Binding Path=FileName,Mode=OneTime}"/>
                <TextBlock TextWrapping="Wrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=FileName,Mode=OneTime}" ToolTip="{Binding Path=FileName,Mode=OneTime}"/>
            </StackPanel>

            <StackPanel Grid.Row="5" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblBarcode}" FontWeight="Heavy"  ToolTip="{Binding Path=BarCode,Mode=OneTime}"/>
                <TextBlock Text="{Binding Path=BarCode,Mode=OneTime}" ToolTip="{Binding Path=BarCode,Mode=OneTime}"/>
            </StackPanel>

            <StackPanel Grid.Row="6" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblDateAdded}"  FontWeight="Heavy" ToolTip="{Binding Path=AddedDate,Mode=OneTime,StringFormat={}{0:d}}"/>
                <TextBlock Text="{Binding Path=AddedDate,Mode=OneTime,StringFormat={}{0:d}}" ToolTip="{Binding Path=AddedDate,Mode=OneTime,StringFormat={}{0:d}}" />
            </StackPanel>

            <StackPanel Grid.Row="7" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblDateReleased}" FontWeight="Heavy" ToolTip="{Binding Path=ReleaseDate,Mode=OneTime,StringFormat={}{0:d}}"/>
                <TextBlock Text="{Binding Path=ReleaseDate,Mode=OneTime,StringFormat={}{0:d}}" ToolTip="{Binding Path=ReleaseDate,Mode=OneTime,StringFormat={}{0:d}}"/>
            </StackPanel>

            <StackPanel Grid.Row="8" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblLanguage}" FontWeight="Heavy" ToolTip="{Binding Path=Language.DisplayName,Mode=OneTime}"/>
                <TextBlock Text="{Binding Path=Language.DisplayName,Mode=OneTime}" ToolTip="{Binding Path=Language.DisplayName,Mode=OneTime}"/>
            </StackPanel>

            <StackPanel Grid.Row="9" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblFormat}" FontWeight="Heavy" ToolTip="{Binding Path=FileFormat.Name,Mode=OneTime}"/>
                <TextBlock Text="{Binding Path=FileFormat.Name,Mode=OneTime}" ToolTip="{Binding Path=FileFormat.Name,Mode=OneTime}"/>
            </StackPanel>

            <StackPanel Grid.Row="10" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblLinks}" FontWeight="Heavy" Name="titleLinks"/>
                <ListBox Name="lstLinks" BorderBrush="Transparent" Background="Transparent" BorderThickness="0"/>
            </StackPanel>

            <StackPanel Grid.Row="11" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblType}" FontWeight="Heavy" Name="titleType"/>
                <TextBlock Name="lblType"/>
            </StackPanel>

            <StackPanel Grid.Row="12" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource PublicRating}" FontWeight="Heavy" ToolTip="{Binding Path=PublicRating,Mode=OneTime}"/>
                <TextBlock Text="{Binding Path=PublicRating,Mode=OneTime}" ToolTip="{Binding Path=PublicRating,Mode=OneTime}"/>
            </StackPanel>

            <StackPanel Grid.Row="13" Orientation="Horizontal">
                <TextBlock Text="{DynamicResource lblRating}" FontWeight="Heavy" ToolTip="{Binding Path=MyRating,Mode=OneTime}"/>
                <TextBlock Text="{Binding Path=MyRating,Mode=OneTime}" ToolTip="{Binding Path=MyRating,Mode=OneTime}"/>
            </StackPanel>

            <TextBlock Text="{Binding Path=Description,Mode=OneTime}"  Grid.Row="14"
                           TextWrapping="Wrap"
                           TextTrimming="CharacterEllipsis" TextAlignment="Left"/>

            <TextBlock Text="{Binding Path=Comments,Mode=OneTime}"  Grid.Row="15"
                           TextWrapping="Wrap" TextTrimming="CharacterEllipsis" TextAlignment="Left"/>

            <StackPanel Grid.Row="16" Orientation="Horizontal" ToolTip="{Binding Path=Isbn,Mode=OneTime}">
                <TextBlock Text="{DynamicResource lblISBN}" FontWeight="Heavy"/>
                <TextBlock Text="{Binding Path=Isbn,Mode=OneTime}" TextWrapping="Wrap" TextAlignment="Left"/>
            </StackPanel>

            <StackPanel Grid.Row="17" Orientation="Horizontal" ToolTip="{Binding Path=App_Editor.Name,Mode=OneTime}">
                <TextBlock Text="{DynamicResource lblEditor}" FontWeight="Heavy"/>
                <TextBlock Text="{Binding Path=Publisher.Name,Mode=OneTime}" TextWrapping="Wrap" TextAlignment="Left"/>
            </StackPanel>

            <StackPanel Grid.Row="18" Orientation="Horizontal" ToolTip="{Binding Path=NbrPages,Mode=OneTime}">
                <TextBlock Text="{DynamicResource lblPages}" FontWeight="Heavy" />
                <TextBlock Text="{Binding Path=NbrPages,Mode=OneTime}" TextAlignment="Left"/>
            </StackPanel>

            <StackPanel Grid.Row="19" Orientation="Horizontal" ToolTip="{converters:SwitchBinding IsRead, {DynamicResource Yes}, {DynamicResource No}}">
                <TextBlock Text="{DynamicResource lblRead}" FontWeight="Heavy" />
                <TextBlock Text="{converters:SwitchBinding Watched, {DynamicResource Yes}, {DynamicResource No}}"/> 
            </StackPanel>

            <StackPanel Grid.Row="20" Orientation="Horizontal" ToolTip="{converters:SwitchBinding ToRead, {DynamicResource Yes}, {DynamicResource No}}">
                <TextBlock Text="{DynamicResource lblToRead}" FontWeight="Heavy"/>
                <TextBlock Text="{converters:SwitchBinding ToWatch, {DynamicResource Yes}, {DynamicResource No}}"/>
            </StackPanel>

            <StackPanel Grid.Row="21" Orientation="Horizontal" ToolTip="{converters:SwitchBinding ToBeDeleted, {DynamicResource Yes}, {DynamicResource No}}">
                <TextBlock Text="{DynamicResource lblToBeDeleted}" FontWeight="Heavy"/>
                <TextBlock Text="{converters:SwitchBinding ToBeDeleted, {DynamicResource Yes}, {DynamicResource No}}"/> 
            </StackPanel>

            <StackPanel Grid.Row="22" Orientation="Horizontal" ToolTip="{converters:SwitchBinding IsComplete, {DynamicResource Yes}, {DynamicResource No}}">
                <TextBlock Text="{DynamicResource lblComplete}" FontWeight="Heavy"/>
                <TextBlock Text="{converters:SwitchBinding IsComplete, {DynamicResource Yes}, {DynamicResource No}}"/> 
            </StackPanel>

            <StackPanel Grid.Row="23" Orientation="Horizontal" ToolTip="{converters:SwitchBinding IsWhish, {DynamicResource Yes}, {DynamicResource No}}">
                <TextBlock Text="{DynamicResource lblWish}" FontWeight="Heavy"/>
                <TextBlock Text="{converters:SwitchBinding IsWhish, {DynamicResource Yes}, {DynamicResource No}}"/> 
            </StackPanel>
        </Grid>
    </ScrollViewer>
</UserControl>
